//
//  ViewController.m
//  03_Homework
//
//  Created by 徐昊 on 16/7/18.
//  Copyright © 2016年 徐昊. All rights reserved.
//

#import "ViewController.h"
#import "UILabel+HXButton.h"
#import "UIImageView+ImageButton.h"
@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
    
//    通过UILabel封装实现只显示文字的Button
//    通过UIImageView封装实现只显示图片的Button 以上两种方式, 要考虑到通用性。 封装时, 记得使用iOS9新特性
//    使用自己封装的控件, 加入到前两天编写的登陆页中
    self.view.backgroundColor = [UIColor whiteColor];
    UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 200, 200) text:@"button" target:self action:@selector(clickLabel:)];
    label.backgroundColor = [UIColor redColor];
    [self.view addSubview:label];
    
    UIImage *image = [UIImage imageNamed:@"342f5e9752dd6db5"];
    UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 300, 240, 300) image:image target:self action:@selector(clickImageView:)];
    [self.view addSubview:imageView];
}
- (void)clickLabel:(UILabel *)label {
    NSLog(@"文字button");
}

- (void)clickImageView:(UIImageView *)imageView {
    NSLog(@"图片button");
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
